<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>First Consult</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
function deleteUser(index,data){
	document.getElementById(index).disabled = true;
	jQuery.ajax({url:"DocComment", type:"get" , data:{data:data}, async:false, success:function(data){
	}});
}

function showPosts(data){
	jQuery.ajax({url:"DocUserPostList", type:"get" , data:{data:data},success:function(data){
	}});
}
$(document).ready(function(){

	$("#postQues").hide();
	$("#postQuestionBtn").click(function()
{
		$("#postQues").show();	
});
	$("#clearbtn").click(function()
			{
				
		  $("#label").val("");
		  $("#question").val("");
		$("#postQues").hide();
				
			});
	
	$("#submitbtn").click(function(){
		var label = $("#label").val();
		var question = $("#question").val();
		alert(label);
		var userId = "<%= session.getAttribute("userid") %>";		
		if(label != "" & question != "")
				  $.ajax({url:"DoctorQues", type:"get" ,asynch:false, data: {label:label,question:question, userid: userId},success:function(data)
					  {
						  $("#label").val("");
						  $("#question").val("");
					  }  
				  });
	});
	
	});
</script>
</head>

<body>
<form action="DocUserPostList" method="get">

 <div id="middlePan">

	<div id="middlebodyPan">
	<jsp:useBean id="userListService" class="service.ViewUsersList" scope="session"></jsp:useBean>
	<%String[] usersList =userListService.getUsers(request.getSession().getAttribute("docid").toString());%>
	<%	String user[]; %>
	<%	String userids= ""; %>
	<% if(usersList==null){ %>
	<h3>There are no users in your list!!</h3> 
	<% } else { %>
		<% 
		for( int i=0;i<usersList.length;i++ ){ 
			user = usersList[i].split("%");
			userids += user[4];
			System.out.println("userids" + userids);
		request.getSession().setAttribute("userids",userids);
		%>
	<div style="background-color: #EFEDD8; margin-top: 10px;" >
	<table style="width:100%;">
		<tr> <td><b> <%=user[0] %>&nbsp;&nbsp;</b></td> <td><input type="submit"  value="Posts" ></td> </tr>
		<tr> <td>	<%-- <input type="hidden" name="userValue" value="<%=user[4]%>"/> --%>
		<b>&nbsp;&nbsp;&nbsp;<%=user[3] %> </b></td></tr>
	</table>
</div>
<% } %>
	<% } %>
 </div>
 </div>	  	
</form>
</body>
</html>
